<template>
  <div class="home-box">
    <!-- 轮播图 -->
    <swiper :props="lunbotuList"></swiper>
    <!-- 6宫格 -->
    <ul class="mui-table-view mui-grid-view mui-grid-9">
        <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3" v-for="items in contentList" :key="items.url">
            <router-link :to="items.to">
                <img :src="items.url" alt>
                <div class="mui-media-body">{{items.content}}</div>
            </router-link>
        </li>
    </ul>
  </div>
</template>

<script>
import { Toast } from "mint-ui";
import swiper from '../common/swiper.vue';
export default {
    data() {
        return {
            lunbotuList: [],
            contentList:[
                {to:'/NewsList',url:'../../images/menu1.png',content:'新闻资讯'},
                {to:'/imgsList',url:'../../images/menu2.png',content:'图片分享'},
                {to:'/goodsList',url:'../../images/menu3.png',content:'商品购买'},
                {to:'',url:'../../images/menu4.png',content:'留言反馈'},
                {to:'',url:'../../images/menu5.png',content:'视频专区'},
                {to:'',url:'../../images/menu6.png',content:'联系我们'},
            ]
        }
    },
    components:{
        swiper
    },
    created() {
        this.getLunbotu();
    },
    methods:{
        getLunbotu(){
            // 获取轮播图数据的方法
            this.$http.get("api/getlunbo").then(result => {
                // console.log(result.body)
                if (result.body.status === 0) {
                    //成功
                    this.lunbotuList = result.body.message;
                } else {
                    // 失败的
                    Toast("加载轮播图失败。。。");
                }
            })
        }
    }
}
</script>

<style lang="scss" scoped>
.home-box{
    .mui-grid-view.mui-grid-9{
        background-color: #fff;
        img{
            width: 60px;
            height: 60px;
        }
    }
}
</style>
